remotemanager.storage.function module¶
- remotemanager.storage.function.line_is_end_of_function(line: str) bool [source]¶
Returns True if the line is the end of a function definition
- class remotemanager.storage.function.Function(func: [typing.Callable, <class 'str'>], force_self: bool = False)[source]¶
Serialise function to an executable python file for transfer
- Parameters:
func – python function for serialisation
- static get_raw_signature(source)[source]¶
Strips the signature as it is typed. inspect.signature does some formatting which can cause replacement to break in some conditions
- Parameters:
source (str) – raw source
- Returns:
raw signature as typed
- Return type:
(str)
- static prepare_signature(sig, is_self: bool = False) str [source]¶
Inserts *args and **kwargs into any signature that does not already have it
- Parameters:
sig – inspect.signature(func)
is_self – inspect.signature ignores self, yet we want to preserve it. Adds the argument if True
- Returns:
formatted sig
- Return type:
(str)
- replace_signature(source: str, rawsig: str, signature: str) str [source]¶
Performs replacement of the original “raw” signature with one with inserted *args, **kwargs
- property name: str¶
Function name
- property raw_source: str¶
Function source
- property source: str¶
Function source
- Returns:
source code
- Return type:
(str)
- property args: list¶
returns a list of arguments, without annotations or defaults
- property uuid: str¶
Function uuid (64 characters)
- property object¶
Recreates the function object by writing out the source, and importing.
- Returns:
the originally passed function
- Return type:
Callable